package second.filter;


import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
//配置拦截路径
@WebFilter(value = "/hello.jsp")
public class Filter1 implements Filter {
    //过滤器初始化方法
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("myfilter初始化了............");
    }
    //执行过滤
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

        //执行目标资源（放行目标资源）
        System.out.println("myfilter 过滤之前.............");
        chain.doFilter(request, response);
        System.out.println("myfilter 过滤之后.............");
    }

    @Override
    public void destroy() {
        System.out.println("myfilter销毁了......");
    }
}
